/*
 * Copyright 2018 Zhongan.com All right reserved. This software is the
 * confidential and proprietary information of Zhongan.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Zhongan.com.
 */

package com.example.cloud.service;

import java.util.concurrent.TimeUnit;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 熔断测试
 *
 * @author tongyufu
 */
@RestController
public class HystrixService {

    /**
     * slowRequest
     *
     * @return slowRequest
     */
    @RequestMapping("/hystrix/slow")
    public String slowRequest() {
        System.out.println("======slowRequest");
        this.slowRequest2();
        return "slowRequest";
    }

    /**
     * slowRequest
     *
     * @return slowRequest
     */
    public String slowRequest2() {
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "slowRequest";
    }

}
